<template>
    <el-submenu v-if="item.subMenu && item.subMenu.length" :index="String(item.id)">
        <template slot="title">{{ item.text }}</template>
        <my-item v-for="subItem in item.subMenu" :key="subItem.id" :item="subItem"></my-item>
    </el-submenu>
    <el-menu-item v-else :index="String(item.id)">{{ item.text }}</el-menu-item>
</template>

<script>
  export default {
    name: 'MyItem',
    props: ['item']
  };
</script>
